<?php use_stylesheet('/enermaatik/tellimusevaade.css') ?>
<?php use_stylesheet('/enermaatik/maksmine.css') ?>

<div class="ccontentbox">
	<div class="ccontent">
<?php include_partial('basketPage/progress', array('node' => $node)) ?>
<div class="korvsisu">
	<h1><?php echo __('maksja andmed') ?></h1>

	<div class="korvinfobox">
		<div class="korvinfoboxrow">
			<div class="korvinfoboxleft"></div>
			<div class="korvinfoboxright">
				<h2><?php echo $user['name'] ?></h2>
			</div>
			<div class="clear"></div>
		</div>
		<div class="korvinfoboxrow">
			<div class="korvinfoboxleft">
				<p><?php echo __('email') ?></p>
			</div>
			<div class="korvinfoboxright">
				<p><?php echo $user['email'] ?></p>
			</div>
			<div class="clear"></div>

		</div>
		<div class="korvinfoboxrow">
			<div class="korvinfoboxleft">
				<p><?php echo __('kohaletoimetamise aadress') ?></p>
			</div>
			<div class="korvinfoboxright">
				<p><?php echo $basket->renderShippingAddress() ?></p>
			</div>

			<div class="clear"></div>
		</div>
		<div class="korvinfoboxrow">
			<div class="korvinfoboxleft">
				<p><?php echo __('arveldusaadress') ?></p>
			</div>
			<div class="korvinfoboxright">
				<p><?php echo $basket->renderBillingAddress() ?></p>
			</div>

			<div class="clear"></div>
		</div>
		<div class="korvinfoboxrow">
			<div class="korvinfoboxleft">
				<p><?php echo __('transpordi tsoon') ?></p>
			</div>
			<div class="korvinfoboxright">
				<p><?php echo $basket->renderShippingZone() ?></p>
			</div>

			<div class="clear"></div>
		</div>

	</div>

<div class="clear"></div><br /><br />

<!-- TOODETE Tabel -->
<h1><?php echo __('valitud tooted') ?></h1>
<div class="tabel">
	<?php include_partial('basketPage/userBasketListTable', array('products'=>$products, 'ro' => true)) ?>
	<div class="clear"></div>
</div>
<div class="tablekokku">
	<?php include_partial('basketPage/userBasketListTotalPayable', array('totalPayable' => $totalPayable)) ?>
</div>
<div class="clear"></div>
<!-- toodete tabel ends -->
	
<?php include_partial('basketPage/paymentMethods') ?>

<?php include_partial('basketPage/termsAndConds', array('termsAndConditionsNode' => $termsAndConditionsNode)) ?>

<!--maksmise valik ends -->
</div>
<div class="ccontentmainbottom"></div>
	<div class="tablebuttons">
		<div class="hallbutton">
			<div class="hallbuttonleft"><img src="/enermaatik/img/tbl.png" width="8" height="26" alt=""/></div>
			<div class="hallbuttoncenter">
				<p><a href="<?php echo __('epoodi_link') ?>"><?php echo __('jätka ostmist') ?></a></p>
			</div>
			<div class="hallbuttonright"><img src="/enermaatik/img/tbr.png" width="8" height="26" alt=""/></div>
			<div class="clear"></div>

		</div>
		<div class="button">
			<div class="buttonleft"><img src="/enermaatik/img/rbleft.png" width="8" height="26" alt=""/></div>
			<div class="buttoncenter">
				<p><a class="proceed" href="<?php echo LinkGen::getInstance(LinkGen::STRUCTURE_ACTIONS)->link(null, array('module' => 'basketPage', 'action' => 'doCheckout')) ?>"><?php echo __('vormista ost') ?></a></p>
			</div>
			<div class="buttonright"><img src="/enermaatik/img/rbr.png" width="8" height="26" alt=""/></div>
			<div class="clear"></div>

		</div>
		<div class="clear"></div>
	</div>
</div>
</div>

<script type="text/javascript">
$('.proceed').click(function(e){
	e.preventDefault();

	var paymentTypeContainer = $('#selected_payment');
	var termsAndConds = $('#terms_and_conditions');
	var link = jQuery.queryString($(this).attr('href'), 'type=' + paymentTypeContainer.text() );

	if(paymentTypeContainer.text() == ''){
		alert('select payment method');
		return false;
	}

	if(!termsAndConds.hasClass('active')){
		alert('accept terms and conditions');
		return false;
	}

	window.location.href = link;

	return false;
});
</script>